<?php

use Illuminate\Routing\Router;


Route::group([
    'prefix' => 'admin/push',
    'namespace' => 'Frieza\\Modules\\Push\\Controllers',
    'middleware' => [
        'web',
        'admin'
    ],
], function (Router $router) {
    $router->get('/index', 'IndexController@index');
    $router->get('/timer', 'IndexController@timer');
    $router->get('/timer/{groupId}', 'IndexController@timer');
    $router->get('/other', 'IndexController@other');

    $router->get('/create', 'IndexController@create');
    $router->get('/task/{id}', 'IndexController@create');

    $router->post('/sort', 'IndexController@sort');
    $router->post('/timer/sort', 'IndexController@sort');
    $router->post('/save', 'IndexController@save');
    $router->post('/task/{id}/cancel', 'IndexController@cancel');
    $router->post('/task/{id}/cancelGroup', 'IndexController@cancelGroup');
    $router->post('/task/{id}/unlockGroup', 'IndexController@unlockGroup');
    $router->post('/task/{id}/lockGroup', 'IndexController@lockGroup');

    //push template
    $router->get('/pushTemplate', 'PushTemplateController@index');
    $router->get('/pushTemplate/create', 'PushTemplateController@create');
    $router->get('/pushTemplate/{id}/edit', 'PushTemplateController@create');
    $router->post('/pushTemplate/save', 'PushTemplateController@save');

    //创建推送
    $router->get('/notify', 'NotifyController@index');
    $router->post('/notify/send', 'NotifyController@send');
    //场景push
    $router->get('/ScenePush/list', 'ScenePushController@index');
    $router->get('/ScenePush/list/create', 'ScenePushController@create');
    $router->get('/ScenePush/list/{id}/edit', 'ScenePushController@create');
    $router->post('/ScenePush/save', 'ScenePushController@save');
    //推送类型
    $router->get('/pushType', 'PushTypeController@list'); // 列表
    $router->get('/pushType/create', 'PushTypeController@firstEdit'); //创建一级类型
    $router->get('/pushType/{firstId}/edit', 'PushTypeController@firstEdit'); //编辑一级类型
    $router->post('/pushType/{firstId}/save', 'PushTypeController@saveFirst'); //保存一级类型
    $router->get('/pushType/{firstId}/edit/create', 'PushTypeController@childEdit'); //创建二级类型
    $router->get('/pushType/{firstId}/edit/{secondId}/edit', 'PushTypeController@childEdit'); //编辑二级类型
    $router->post('/pushType/{firstId}/edit/{secondId}/save', 'PushTypeController@saveSecond'); //保存二级类型
    //推送触发规则
    $router->get('/pushRule/{channel?}', 'PushRuleController@list'); // 列表
    $router->get('/pushRule/{channel}/{id}/edit', 'PushRuleController@edit'); //编辑推送规则
    $router->post('/pushRule/{id}/save', 'PushRuleController@save'); //保存推送规则
});
